/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package ejb.products;

import java.io.Serializable;
import java.util.List;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.ejb.EJBException;
import javax.ejb.Singleton;
import jpa.controller.ProductopreRegistroJpaController;
import jpa.entities.ProductopreRegistro;

/**
 *
 * @author Diego Curbelo
 */
@Singleton
public class ProductPreRegEJB implements Serializable{
    
    public ProductPreRegEJB() {
    }

    public List<ProductopreRegistro> listarProductsDelPreRegistro(Integer idPreRegistro)throws EJBException{
		List <ProductopreRegistro> listProducts;
		listProducts = new ProductopreRegistroJpaController().findProductopreRegistroEntitiesForPreRegistro(idPreRegistro);
		return listProducts;
    }

   /* public void updateProdInv(Productoinventario prod)throws EJBException{
        try {
            new ProductoinventarioJpaController().edit(prod);
        } catch (IllegalOrphanException ex) {
            Logger.getLogger(ProductPreRegEJB.class.getName()).log(Level.SEVERE, null, ex);
        } catch (NonexistentEntityException ex) {
            Logger.getLogger(ProductPreRegEJB.class.getName()).log(Level.SEVERE, null, ex);
        } catch (Exception ex) {
            Logger.getLogger(ProductPreRegEJB.class.getName()).log(Level.SEVERE, null, ex);
        }
    }*/

    public void registrarProductoPreRegistro(ProductopreRegistro prod)throws EJBException{
        try {
            new ProductopreRegistroJpaController().create(prod);
        } catch (Exception ex) {
            Logger.getLogger(ProductPreRegEJB.class.getName()).log(Level.SEVERE, null, ex);
        }
    }
 
}
